package zju.ccnt.rest.api;

import zju.ccnt.rest.domain.EndUser;
import zju.ccnt.rest.service.validation.NumericalLikeValidator;
import zju.ccnt.rest.service.validation.ValidNumericalLike;
import zju.ccnt.oauth2.user.api.ApiUser;

import javax.validation.constraints.NotNull;

/**
 * Created by zha on 14/11/6.
 */
public class ApiEndUser extends ApiUser{

    @NotNull
    @ValidNumericalLike(type = NumericalLikeValidator.NumericalEnum.PHONE)
    private String phone;

    public ApiEndUser(){}

    public ApiEndUser(EndUser endUser) {
        super(endUser.getId(), endUser.getEmail(), endUser.getName());
        this.phone = endUser.getPhone();
        this.setId(endUser.getId());
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
